const express = require("express");
const router = express.Router();
const user_handler = require("../router_handler/user");

const expressJoi = require("@escook/express-joi");
const {
  user_login,
  user_reg,
  user_reset,
  user_updateAvatar,
} = require("../schema/user");

// 用户注册
router.post("/register", expressJoi(user_reg), user_handler.userReg);
// 用户登录
router.post("/login", expressJoi(user_login), user_handler.userLogin);
// 用户重置密码
router.post(
  "/resetpassword",
  expressJoi(user_reset),
  user_handler.resetPassword
);
// 修改头像
router.post(
  "/update/avatar",
  expressJoi(user_updateAvatar),
  user_handler.updateAvatar
);

module.exports = router;
